package com.taplinker.client.im.rpc.response;

import com.taplinker.client.im.domain.ImDataCenter;
import com.taplinker.client.im.protocol.TapLinkerConversation;
import com.taplinker.client.im.rpc.body.Cmd1008Rep;
import com.taplinker.core.rpc.Result;
import com.taplinker.core.util.json.JsonUtil;

public class Cmd1008  implements ImResponse{

	@Override
	public void yes(Result result) {
		Cmd1008Rep value = JsonUtil.jsonToObject(result.object.toString(), Cmd1008Rep.class);
		
		TapLinkerConversation conversation = ImDataCenter.getInstance().getConversation(value.getConversationId());
		if(conversation == null) {
			return;
		}
		conversation.setCustomerId(value.getCustomerId());
		conversation.setCustomerName(value.getCustomerName());
		ImDataCenter.getInstance().noticeListener(ImDataCenter.QUEUE_REFRESH);
		
	}

	@Override
	public String getCommand() {
		return "1008";
	}

}